The do...while
statement creates a loop that executes a block of code once, before checking if the condition is true
, then it will repeat the loop as long as the condition is true
.
let i = 0;
do {
console.log(i);
i++;
} while (i < 3);
// 0
// 1
// 2